package com.example.medicine;

import com.example.medicine.Bean.yian.yian;
import com.example.medicine.Bean.yian.yian_chufang;
import com.example.medicine.Bean.yian.yian_jibing;
import com.example.medicine.Bean.yian.yian_xiyi;
import com.example.medicine.Mapper.mzhenMapper;
import com.example.medicine.Mapper.yian.yianMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
public class yianSelectController {
    @Autowired
    yianMapper yianMapper;
    @Autowired
    mzhenMapper mzhenMapper;
    @PostMapping("/wxya/inquiry")
    public List<yian> selectyian(@RequestParam("chufang")String zhongyaoming,
                                              @RequestParam("xiyi")String name,
                                              @RequestParam("zhongyi")String mingcheng){
        log.info("文献医案检索");
        yian_chufang yianChufang=new yian_chufang();
        yianChufang.setZhongyaoming(zhongyaoming);
        yian_xiyi yianXiyi=new yian_xiyi();
        yianXiyi.setName(name);
        yian_jibing yianJibing=new yian_jibing();
        yianJibing.setMingcheng(mingcheng);
        List<yian> yians=yianMapper.yianselect(yianChufang,yianXiyi,yianJibing);
        return yians;
    }
    @PostMapping("/mzhen/inquiry")
    public List<yian> selectmzhen(@RequestParam("chufang")String zhongyaoming,
                                              @RequestParam("xiyi")String name,
                                              @RequestParam("zhongyi")String mingcheng){
        log.info("门诊医案检索");
        yian_chufang yianChufang=new yian_chufang();
        yianChufang.setZhongyaoming(zhongyaoming);
        yian_xiyi yianXiyi=new yian_xiyi();
        yianXiyi.setName(name);
        yian_jibing yianJibing=new yian_jibing();
        yianJibing.setMingcheng(mingcheng);
        List<yian> yians=mzhenMapper.mzhenselect(yianChufang,yianXiyi,yianJibing);
        return yians;
    }

}
